package b_thread;

/**
 * @author Cheng-02
 * @version V1.0
 * @Package b_thread
 * @date 2024/4/7 下午5:29
 */
public class test06 {
    public static void main(String[] args) {
        test2 tt = new test2();
        test2 tt1 = new test2();
        tt.setName("线程1");
        tt1.setName("线程2");
        tt1.start();
        tt.start();
    }
}

class test2 extends Thread {
    public void run() {
        for (int i = 0; i < 100; i++)
            System.out.println(Thread.currentThread().getName()+"执行了：" + i);
        Thread.yield();//礼让
    }

}